#ifndef UDPRECIOVER_H
#define UDPRECIOVER_H

#include <QUdpSocket>
#include <QThread>
#include <QQueue>

#include "Define.h"

class UDPReceiver : public QObject
{
	Q_OBJECT

	public:
		UDPReceiver();
		~UDPReceiver();
		bool Initialize();
		bool Bind(int port);

	private slots:
		void ReadDatagram();

	signals:
		void sigDatagramReceived(UDPPacket *packet);

	private :
		QThread *_thread;
		QUdpSocket _socket;
		QQueue<UDPPacket *> _recvQueue;
};

UDPReceiver *GetUDPReceiver();
#define UDP_RECEIVER (GetUDPReceiver())

#endif // UDPRECIOVER_H
